// startup.cpp
// Customizer_Pro
// Protea Customizer Pro / Entry points for Customizer Pro
// Copyright (C) 2003, 2004, 2005 eXegeSys, Inc.
// Copyright (C) 2008 Bruce A. James
//
// This program is part of the Protea Project.
//
// The Protea Project is free software; you can redistribute it and/or modify it 
// under the terms of the GNU General Public License as published by the 
// Free Software Foundation, either version 3 of the License, or (at your 
// option) any later version.
//
// The Protea Project is distributed in the hope that it will be useful, but 
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
// for more details.
// 
// You should have received a copy of the GNU General Public License along 
// with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// Please send correspondence to:
//
// theproteaproject@gmail.com
//

#include "pro_customizer.h"


/////////////////////////////
//
// Transaction definitions
//
/////////////////////////////

// Applications
TRANSACTION( AddApplication );

// Components
TRANSACTION( AddComponent );
TRANSACTION( DeleteComponent );

// Fields
TRANSACTION( AddFieldPro );
TRANSACTION( ChgFieldPro );
TRANSACTION( DeleteFieldPro );
TRANSACTION( CopyFieldPro );

// Formats
TRANSACTION( AddFormatPro );
TRANSACTION( ChgFormatPro );
TRANSACTION( DeleteFormatPro );
TRANSACTION( CopyFormatPro );

// Data structures
TRANSACTION( AddDataStructurePro );
TRANSACTION( ChgDataStructurePro );
TRANSACTION( DelDataStructurePro );

// Languages
TRANSACTION( AddLanguage );
TRANSACTION( DelLanguage );

// Sys vals
TRANSACTION( AddSystemValue );
TRANSACTION( DeleteSystemValue );

// Transactions
TRANSACTION( AddTransaction );
TRANSACTION( DeleteTransaction );

// User Exits
TRANSACTION( AddUserExit );
TRANSACTION( DeleteUserExit );

// Messages
TRANSACTION( AddMessagePro );
TRANSACTION( DelMessagePro );

// Literal Groups
TRANSACTION( AddLiteralGroupPro );
TRANSACTION( DeleteLiteralGroupPro );
TRANSACTION( ChangeLiteralGroupPro );

// Literals
TRANSACTION( AddLiteralPro );
TRANSACTION( DeleteLiteralPro );
TRANSACTION( ChangeLiteralPro );

// Literal Relations
TRANSACTION( AddLitToGroupPro );
TRANSACTION( DelLitFromGroupPro );


TRANSACTION_CODE( ProInstalled ) {
	START_JOB_TXN( ProInstalled );
		txnvars.result->SetSuccess( true );
	CLEANUP_TXN();
	END_TXN();
};



extern "C" {

__EXPORT bool XCTransactionCode( XCTransRegServer* svr ) {
	// Check customizer pro licensing
	if ( true ) {  // hard-code to "true" for now
		printf( "*******************************\n" );
		printf( "Loading Customizer Pro transactions\n" );
		printf( "*******************************\n" );

		// Application
		svr->RegisterTransaction( TRANS_ADDAPPLICATION, AddApplication );

		// Components
		svr->RegisterTransaction( TRANS_ADDCOMPONENT, AddComponent );
		svr->RegisterTransaction( TRANS_DELCOMPONENT, DeleteComponent );

		// Fields
		svr->RegisterTransaction( TRANS_ADDFIELDPRO, AddFieldPro );
		svr->RegisterTransaction( TRANS_CHGFIELDPRO, ChgFieldPro );
		svr->RegisterTransaction( TRANS_DELETEFIELDPRO, DeleteFieldPro );
		svr->RegisterTransaction( TRANS_COPYFIELDPRO, CopyFieldPro );

		// Formats
		svr->RegisterTransaction( TRANS_ADDFORMATPRO, AddFormatPro );
		svr->RegisterTransaction( TRANS_CHGFORMATPRO, ChgFormatPro );
		svr->RegisterTransaction( TRANS_DELFORMATPRO, DeleteFormatPro );
		svr->RegisterTransaction( TRANS_COPYFORMATPRO, CopyFormatPro );

		// Data-structures
		svr->RegisterTransaction( TRANS_ADDDATASTRUCTUREPRO, AddDataStructurePro );
		svr->RegisterTransaction( TRANS_CHGDATASTRUCTUREPRO, ChgDataStructurePro );
		svr->RegisterTransaction( TRANS_DELDATASTRUCTUREPRO, DelDataStructurePro );

		// Languages
		svr->RegisterTransaction( TRANS_ADDLANG, AddLanguage );
		svr->RegisterTransaction( TRANS_DELLANG, DelLanguage );

		// System Values
		svr->RegisterTransaction( TRANS_ADDSYSVAL, AddSystemValue );
		svr->RegisterTransaction( TRANS_DELSYSVAL, DeleteSystemValue );

		// Transactions
		svr->RegisterTransaction( TRANS_ADDTRANS, AddTransaction );
		svr->RegisterTransaction( TRANS_DELTRANS, DeleteTransaction );

		// User exits
		svr->RegisterTransaction( TRANS_ADDUE, AddUserExit );
		svr->RegisterTransaction( TRANS_DELUE, DeleteUserExit );

		// Messages
		svr->RegisterTransaction( TRANS_ADDMESSAGEPRO, AddMessagePro );
		svr->RegisterTransaction( TRANS_DELMESSAGEPRO, DelMessagePro );

		// Literal Groups
		svr->RegisterTransaction( TRANS_ADDLITGROUPPRO, AddLiteralGroupPro );
		svr->RegisterTransaction( TRANS_DELETELITGROUPPRO, DeleteLiteralGroupPro );
		svr->RegisterTransaction( TRANS_CHGLITGROUPPRO, ChangeLiteralGroupPro );

		// Literals
		svr->RegisterTransaction( TRANS_ADDLITERALPRO, AddLiteralPro );
		svr->RegisterTransaction( TRANS_DELLITERALPRO, DeleteLiteralPro );
		svr->RegisterTransaction( TRANS_CHGLITERALPRO, ChangeLiteralPro );

		// Literal relations
		svr->RegisterTransaction( TRANS_ADDLITTOGROUPPRO, AddLitToGroupPro );
		svr->RegisterTransaction( TRANS_DELLITFROMGROUPPRO, DelLitFromGroupPro );

		// Setup
		svr->RegisterTransaction( TRANS_PRO_INSTALLED, ProInstalled );
	} else
		printf( "Not licensed for customizer pro technology\n" );

	return true;
};

};
